package com.dearcocoa.service.impl;

import com.dearcocoa.entity.User;
import com.dearcocoa.mapper.UserMapper;
import com.dearcocoa.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dearcocoa.utils.JwtUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author dearcocoa
 * @since 2020-07-25
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Autowired
    private JwtUtil jwtUtil;

    @Autowired
    private UserMapper userMapper;

    @Override
    public User getUserInfo(String jwt) {
        String userid = jwtUtil.getUseridFromJwt(jwt);
        return userMapper.selectById(userid);
    }
}
